-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@xstate/store] v3 #5175
base: main
Are you sure you want to change the base?
[@xstate/store] v3 #5175
Conversation
🦋 Changeset detectedLatest commit: e6c2523 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Added `StoreEffect` type to support both emitted events and side effects. - Updated `createStoreTransition` to return effects instead of emitted events. - Modified `receive` function to handle effects, executing functions or emitting events accordingly. - Added a test case to verify that effects can be enqueued and executed after state updates. This change improves the flexibility of the store's event handling mechanism.
This reverts commit cfe28e6.
- Updated `createStore` and `createStoreWithProducer` to use more explicit type parameters - Replaced `types: { emitted }` with separate type parameters for context, event payloads, and emitted events - Removed `Cast` import and simplified type definitions - Updated test cases to use new type parameter approach - Added `EventMap` type to support event type mapping
Oh no... 😭 #5183 Figuring out how to pass the types around was difficult. But I think I made some improvements, even beyond the new getter API. But when I saw how many changes where in this PR... I am going to get a beer. |
Hey @expelledboy – computed properties are a great idea! I think you'll find the types even simpler to work with in this PR. Let's make it work. 🛠️ |
|
||
expect(actor.getSnapshot().context.count).toEqual(50); | ||
}); | ||
|
||
it('creates an actor from store logic with input (object API)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is now the only API ;p
it('creates an actor from store logic with input (object API)', () => { | |
it('creates an actor from store logic with input', () => { |
No description provided.